package ae.pcfc.etks.online.common.domain;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

/**
 * ServiceAttr entity. @author Mohtisham.Salahria
 */
@Entity
@Table(name = "T_ETKS_SERVICE_ATTR", schema = "ETKS_ONLINE_DBA")
@SequenceGenerator(name = "SQ_ETKS_SERVICE_ATTR", sequenceName = "SQ_ETKS_SERVICE_ATTR", initialValue = 1, allocationSize = 1)
public class ServiceAttr implements java.io.Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	// Fields

	private Long serviceAttrId;
	private Service Service;
	private String serviceAttrEng;
	private String serviceAttrArb;
	private String serviceAttrNecessity;
	private String serviceAttrStatus;
	private Set<ServiceAttrValue> ServiceAttrValues = new HashSet<ServiceAttrValue>(
			0);
	private Set<ServiceAttrValReq> ServiceAttrValReqs = new HashSet<ServiceAttrValReq>(
			0);

	// Constructors

	/** default constructor */
	public ServiceAttr() {
	}

	/** minimal constructor */
	public ServiceAttr(String serviceAttrEng, String serviceAttrNecessity) {
		this.serviceAttrEng = serviceAttrEng;
		this.serviceAttrNecessity = serviceAttrNecessity;
	}

	/** full constructor */
	public ServiceAttr(Service Service, String serviceAttrEng,
			String serviceAttrArb, String serviceAttrNecessity,
			Set<ServiceAttrValue> ServiceAttrValues,
			Set<ServiceAttrValReq> ServiceAttrValReqs) {
		this.Service = Service;
		this.serviceAttrEng = serviceAttrEng;
		this.serviceAttrArb = serviceAttrArb;
		this.serviceAttrNecessity = serviceAttrNecessity;
		this.ServiceAttrValues = ServiceAttrValues;
		this.ServiceAttrValReqs = ServiceAttrValReqs;
	}

	// Property accessors
	@Id
	@GeneratedValue( strategy = GenerationType.SEQUENCE, generator="SQ_ETKS_SERVICE_ATTR")
	@Column(name = "SERVICE_ATTR_ID", unique = true, nullable = false, precision = 11, scale = 0)
	public Long getServiceAttrId() {
		return this.serviceAttrId;
	}

	public void setServiceAttrId(Long serviceAttrId) {
		this.serviceAttrId = serviceAttrId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "SERVICE_ID")
	public Service getService() {
		return this.Service;
	}

	public void setService(Service Service) {
		this.Service = Service;
	}

	@Column(name = "SERVICE_ATTR_ENG", nullable = false, length = 100)
	public String getServiceAttrEng() {
		return this.serviceAttrEng;
	}

	public void setServiceAttrEng(String serviceAttrEng) {
		this.serviceAttrEng = serviceAttrEng;
	}

	@Column(name = "SERVICE_ATTR_ARB", length = 100)
	public String getServiceAttrArb() {
		return this.serviceAttrArb;
	}

	public void setServiceAttrArb(String serviceAttrArb) {
		this.serviceAttrArb = serviceAttrArb;
	}

	@Column(name = "SERVICE_ATTR_NECESSITY", nullable = false, length = 1)
	public String getServiceAttrNecessity() {
		return this.serviceAttrNecessity;
	}

	public void setServiceAttrNecessity(String serviceAttrNecessity) {
		this.serviceAttrNecessity = serviceAttrNecessity;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "serviceAttr")
	public Set<ServiceAttrValue> getServiceAttrValues() {
		return this.ServiceAttrValues;
	}

	public void setServiceAttrValues(
			Set<ServiceAttrValue> ServiceAttrValues) {
		this.ServiceAttrValues = ServiceAttrValues;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "serviceAttr")
	public Set<ServiceAttrValReq> getServiceAttrValReqs() {
		return this.ServiceAttrValReqs;
	}

	public void setServiceAttrValReqs(
			Set<ServiceAttrValReq> ServiceAttrValReqs) {
		this.ServiceAttrValReqs = ServiceAttrValReqs;
	}
	
	
	@Column(name = "SERVICE_ATTR_STATUS", nullable = false, length = 1)
	public String getServiceAttrStatus() {
		return serviceAttrStatus;
	}

	public void setServiceAttrStatus(String serviceAttrStatus) {
		this.serviceAttrStatus = serviceAttrStatus;
	}

}